<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');
?>

<?php

//get variables passed in
$availability_id = mysql_real_escape_string(strip_tags($_GET['id']));
$q = "SELECT *, i.id AS instructor_id
	  FROM instructor_availability ia
	  JOIN instructors i ON i.id = ia.instructor_id
	  JOIN days d ON d.id = ia.day_id";
$r = mysql_query($q);
$row = mysql_fetch_assoc($r);
$instructor_id = $row['instructor_id'];
$instructor_fname = $row['first_name'];
$instructor_lname = $row['last_name'];
$day_of_week = $row['day_name'];
$starttime = $row['start_time'];
$endtime = $row['end_time'];

echo "<p><a href='update_availability.php?id=$instructor_id'>&lt;&lt; Back to Instructor Availability</a></p>";
echo "<h1>Edit Availability for $instructor_fname $instructor_lname</h1>";

echo "<p>Please enter time in 24 hour, HH:MM:SS format (i.e. 17:30:00)</p>";



echo '<form action="edit_timeslots_do.php" method="post">';

//start table
echo "<table border='0'>";
	
	//create table row with column ID's
	echo "<tr>";
		echo "<td width='80' style='text-align: center'><b>Day</b></td>";
		echo "<td width='80' style='text-align: center'><b>Start Time</b></td>";
		echo "<td width='80' style='text-align: center'><b>End Time</b></td>";
		echo "<td width='80' style='text-align: center'></td>";
		echo "<td width='80' style='text-align: center'></td>";
	echo "</tr>";
	
	echo "<tr>";
		echo "<td width='80' style='text-align: center'>$day_of_week</td>";
		echo "<td width='80' style='text-align: center'><input type='text' name='start' value='$starttime'></td>";
		echo "<td width='80' style='text-align: center'><input type='text' name='end' value='$endtime'></td>";
		
	echo "</tr>";


//end table tag
echo "</table>";

echo "<input type='hidden' name='iid' value='$instructor_id'>";
echo "<input type='hidden' name='id' value='$availability_id'>";
echo '<p><input type="submit"></p>';
echo '</form>';



?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>